<template>
  <el-dialog
    title="工单配置"
    :visible.sync="dialogVisible"
    width="30%"
    :before-close="handleClose"
  >
    <el-form ref="form">
      <el-form-item prop="num" label="补货警戒线" :rules="[{required: true, message: '请输入1-100的值', trigger: 'blur'}]">
        <el-input-number v-model="num" style="width:350px" label="111" controls-position="right" :min="1" :max="100" />
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button style="background-color:#fbf4f0 !important;color:#655b56!important;" @click="handleClose">取 消</el-button>
      <el-button type="primary" style="background:linear-gradient(135deg,#ff9743,#ff5e20)!important;color:#fff;" @click="handleChange">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { getautoSupplyConfig, setautoSupplyConfig } from '@/api/table'
export default {
  name: 'DkdElementInputNumber',
  props: {
    dialogVisible: {
      type: Boolean,
      deafult: true
    }
  },

  data() {
    return {
      num: ''
    }
  },
  mounted() {
    this.getautoSupplyConfig()
  },

  methods: {
    handleChange() {
      this.setautoSupplyConfig()
      this.handleClose()
    },
    handleClose() {
      this.$emit('update:dialogVisible', false)
    },
    async setautoSupplyConfig() {
      await setautoSupplyConfig(this.num)
      this.$message.success('工单配置修改成功')
    },
    async getautoSupplyConfig() {
      const res = await getautoSupplyConfig(1)
      this.num = res
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
